package com.cloud.api.domain.tsp;

import com.cloud.api.utils.ExcelUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Getter
@Setter
@Accessors(chain = true)
@ExcelUtils.ExcelSheet(watermark = @ExcelUtils.Watermark(type = 0)
)
@Schema(name = "VehicleProductionExcel", description = "导入表校验类油车")
public class VehicleProductionExcel1 implements Serializable {

    @Schema(description = "用于导出错误数据")
    @ExcelUtils.ExcelExport(name = "table.field.errResult",columnWidth = 20)
    private String errResult;

    @Schema(description = "用于接收导入车型")
    @ExcelUtils.ExcelExport(name = "table.field.num",columnWidth = 20)
    private String num;

    @NotEmpty(message = "{validation.Information.vin}")
    @ExcelUtils.ExcelExport(name = "table.field.*vin",columnWidth = 20)
    @Size(max = 17,min = 17,message = "{validation.Information.vinSizeExcel}")
    @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{17}$", message = "{validation.Information.vinSize}")
    private String vin;

    @Schema(description = "车型")
    @NotEmpty(message = "{validation.Information.modelExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.*model",columnWidth = 20)
    private String model;

    @Schema(description = "电机号")
    @NotEmpty(message = "{validation.production.motorNumber}")
    @Size(max = 30,min = 1,message = "{validation.common.motorSizeExcel}")
    @Pattern(regexp = "^[A-Za-z0-9]{1,30}$", message = "{validation.production.motorNumberGrex}")
    @ExcelUtils.ExcelExport(name = "table.field.*engineNumber",columnWidth = 20)
    private String motorNumber;

    @Schema(description = "TBOX设备号")
    @NotEmpty(message = "{validation.Information.tbox}")
    @Pattern(regexp = "^[A-Za-z0-9]{1,17}$", message = "{validation.production.tboxNumberRegex}")
//    @Size(max = 17,min = 17,message = "{validation.Information.tboxSizeExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.*tbox",columnWidth = 20)
    private String tboxNumber;

    @Schema(description = "设备编号")
    @Size(max = 17,min = 17,message = "{validation.production.did}")
    @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z0-9]{17}$", message = "{validation.production.didRegex}")
    @ExcelUtils.ExcelExport(name = "table.field.did",columnWidth = 20)
    private String did;

    @Schema(description = "SIM卡号")
    @NotEmpty(message = "{validation.Information.sim}")
    @Size(max = 20,min = 8,message = "{validation.common.simSizeExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.*sim",columnWidth = 20)
    private String simNumber;

    @Schema(description = "ICCID")
    @NotEmpty(message = "{validation.Information.iccid}")
    @Size(max = 30,min = 1,message = "{validation.common.iccidSizeExcel}")
    @Pattern(regexp = "^(?!^[a-zA-Z]+$)[a-zA-Z0-9]{1,30}$", message = "{validation.production.iccidRegex}")
    @ExcelUtils.ExcelExport(name = "table.field.*iccid",columnWidth = 20)
    private String iccid;

    @Schema(description = "生产日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "{validation.production.productionDate}")
    @ExcelUtils.ExcelExport(name = "table.field.*productionDate",columnWidth = 20,dateFormat = "yyyy-MM-dd")
    private Date productionDate;














}
